/**
 * 作用:解析鼠标滑过的地址
 * let isBodyData = util_parseDomPath({
        path: this.mouse_movePath,
        el: "html",
    });
 */


function util_parseDomPath(string){
    let returnString = {
       data:false,
       message:"未知错误",
       dom:"",
       code:-1 
    };
    
    // console.log(string);
    //判断当前数据是否为空
    if(string == undefined || string == "") return returnString;

        let {path,el} = string;


        // console.log(path,el);
        //开始遍历解析内容

        for (let domi = 0; domi < path.length; domi++) {
            let dom = path[domi];
            // console.log("获取当前第一个字符是否是el类型",el[0]);
            // console.dir(dom);  
            
            //判断该当前是否是id
            if(el[0] == "#")
            {
                if("#"+dom.id == el)
                {
                    console.log("当前数组列中是有选中的内容id");
                    returnString.data = true;
                    returnString.dom = dom;
                    returnString.message = "正确,当前数组列中是有选中的内容id";
                    returnString.code = 0;
                    return returnString;
                }
            }
            //判断当前是否是class
            else if(el[0] == ".")
            {   
                if (dom.classList == undefined)   return returnString;


                // dom.classList.length >= 1
                // el.substring(1,el.length)body1
                //判断当前是否有输入的css样式名称
                let isClassName =  dom.classList.contains(el.substring(1,el.length)+"");
                if(isClassName)
                {
                    // console.log("当前数组列中是有选中的内容class");
                    returnString.data = true;
                    returnString.dom = dom;
                    returnString.message = "正确,当前数组列中是有选中的内容class";
                    returnString.code = 0;
                    return returnString;
                }
            }
            //判断当前是否是标签
            else
            {
                if(dom.localName == el)
                {
                    console.log("当前数组列中是有选中的内容dom");
                    returnString.data = true;
                    returnString.dom = dom;
                    returnString.message = "正确,当前数组列中是有选中的内容dom";
                    returnString.code = 0;
                    return returnString;
                }
            }




        }



    return returnString;





}
